POV-Ray : Newsgroups : povray.binaries.images : Problems with rotation... : Problems with rotation... Server Time
19 Aug 2024 04:27:22 EDT (-0400)
  Problems with rotation...  
From: Weinzierl Stefan
Date: 12 Jan 2001 06:39:54
Message: <3A5EE735.FD1A75E4@t-online.de>
Hi,

I know, its a little bit off-topic but I've a little problem with
rotation.

The problem is for a game I need a rolling ball, so I made the matrix in
the first picture with the code below. As you can see in the blue
rectangles this runs good, when I rotate only one axis. But when both
axis must be rotated I don't get the result what I wan't. The second
picture show's how the green marked rectangle should look like. Or in an
other question how could I rotate both axis in the same time?

Can someone help me?

Thanke you,
Stefan


/*******************************************/
#include "colors.inc"   

camera {
   location <0, 0, 0>
   look_at <0, 0, 1>
   up <0, 1, 0>
   right <4/3, 0, 0>  
   orthographic   
}

background { color rgb 1 }    

light_source { <120, 120, -105>, color White }   
	
#declare Ball = union {
   sphere { 0, 1 
      texture {
         pigment { checker Red, White }
         finish {
            ambient .3
            phong .3
            phong_size 20 
         }
      }
   }             
	
   cylinder { y*1.2, y*-1.2, .1 pigment { Blue } finish { ambient .7 } }
   cylinder { x*1.2, x*-1.2, .1 pigment { Green } finish { ambient .7}}
   cylinder { z*1.2, z*-1.2, .1 pigment { Yellow } finish { ambient .7}}
}        

#declare Group = union {
   #local Count=0;
   #while (Count<=35)
      #local rx=int(Count/6);
      #local ry=mod(Count, 6);
				
      object {
         Ball    
         //rotate -rx*30*y 
         //rotate -ry*30*x       
         rotate <-ry*30, -rx*30, 0> 

         translate <(rx-2.5)*2.5, (ry-2.5)*2.5, 0>
         translate z*3 
      }                    
		
      #local Count=Count+1;
   #end
}

object {
   Group     
   scale .0675
   translate z*12
}

/*******************************************/



-- 
http://home.t-online.de/home/StefanWz/


Post a reply to this message


Attachments:
Download 'neu-5.jpg' (18 KB) Download 'neu-6.jpg' (3 KB)

Preview of image 'neu-5.jpg'
neu-5.jpg

Preview of image 'neu-6.jpg'
neu-6.jpg


 

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.